package com.ivvi.autoreco;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;

import com.ivvi.autoreco.opencv.ZFTActivity;
import com.ivvi.autoreco.opencv.ZHHActivity;

import org.opencv.android.OpenCVLoader;

import opengles.HelloOpenglesActivity;

/**
 * Created by duanxianping on 2017/5/25.
 */

public class FirstActivity extends AppCompatActivity {


    private Button btnOpencv;
    private Button btnDhash;
    private Button btnOpenglEs;
    private Button btnZft;
    private Button btnZhh;
    private Button btnFileScan;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        if (!OpenCVLoader.initDebug()) {
            Log.e(this.getClass().getSimpleName(), "  OpenCVLoader.initDebug(), not working.");
        } else {
            Log.d(this.getClass().getSimpleName(), "  OpenCVLoader.initDebug(), working.");
        }

        setContentView(R.layout.activity_first);
        btnOpencv = (Button) findViewById(R.id.btn_opencv);
        btnDhash = (Button) findViewById(R.id.btn_dhash);
        btnOpenglEs = (Button) findViewById(R.id.btn_opengles);
        btnZft = (Button) findViewById(R.id.btn_zft);
        btnZhh = (Button) findViewById(R.id.btn_zhh);
        btnFileScan = (Button) findViewById(R.id.btn_filescan);

        btnOpencv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(FirstActivity.this, MainActivity.class);
                startActivity(intent);
            }
        });

        btnDhash.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(FirstActivity.this, DHashActivity.class);
                startActivity(intent);
            }
        });


        btnOpenglEs.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(FirstActivity.this, HelloOpenglesActivity.class);
                startActivity(intent);
            }
        });

        btnZft.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(FirstActivity.this, ZFTActivity.class);
                startActivity(intent);
            }
        });


        btnZhh.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(FirstActivity.this, ZHHActivity.class);
                startActivity(intent);
            }
        });

        btnFileScan.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(FirstActivity.this, FileScanActivity.class);
                startActivity(intent);
            }
        });

//        Toast.makeText(this,helloJni()+""+addCal(1,2),Toast.LENGTH_SHORT).show();
    }

//    public static native String helloJni();
//    public static native int addCal(int a,int b);
//
//    static {
//        System.loadLibrary("hello_jni");
//    }
}
